package net.da.processor.user.impl;

import net.da.processor.AbstractProcessorMock;
import net.da.processor.user.UpdateUserProcessor;
import net.da.processor.user.io.UpdateUserRequest;
import net.da.processor.user.io.UpdateUserResponse;

public class UpdateUserProcessorMock extends AbstractProcessorMock<UpdateUserResponse, UpdateUserRequest> implements UpdateUserProcessor {

    @Override
    public UpdateUserResponse process(UpdateUserRequest request) {
        UpdateUserResponse updateUserResponse = new UpdateUserResponse();
        updateUserResponse.setAuthenticationError(true);
        if (!request.getOldUserName().equals("ddz")) {
            updateUserResponse.setAuthenticationError(false);
            return updateUserResponse;
        }
        updateUserResponse.setUpdatedSuccessfuly(true);
        throw new UnsupportedOperationException();
    }

    @Override
    protected UpdateUserResponse buildIOResponseEmptyInstance() {
        return new UpdateUserResponse();
    }

}
